import { defineStore } from 'pinia'

export interface Task {
  id: number
  title: string
  desc: string
  priority: 'low' | 'medium' | 'high'
  deadline: string
  isDone: boolean
}

export const useTaskStore = defineStore('task', {
  state: () => ({
    tasks: [] as Task[]
  }),
  actions: {
    addTask(task: Omit<Task, 'id' | 'isDone'>) {
      this.tasks.push({
        ...task,
        id: Date.now(),
        isDone: false
      })
    }
  }
})